let l= [("Don",435.);("Nut",75.);("Toto",42.)];;

let compare a b=
    if a>b then 1
           else if a=b then 0
                       else (-1);;

compare 1 2;;

let rec find x client =
    match client with 
    []-> failwith "Client inconnu"
   |(a,b)::client -> if a=x then b 
                     else find x client;;
find "Toto" l;;
 

let rec add (client,nombre)=function
     [] -> (client,nombre)::[]
    |(e,n)::liste when (String.lowercase e) = (String.lowercase client) -> (e,n)::liste
    |(e,n)::liste when String.lowercase (client) < String.lowercase (e) -> (client,nombre)::(e,n)::liste
    |(e,n)::liste -> (e,n)::(add (client,nombre) liste);;

add ("eugene",81.) l;;


let rec delete client liste =
     match liste with 
     [] -> []
    |(a,b)::liste -> if a=client 
                     then liste 
                     else (a,b)::(delete client liste);;

delete ("Toto",42.);;

let rec update client nombre liste=
     match liste with
      [] -> []
     |(a,b)::liste -> if a=client
                      then (client,b)::liste 
                      else (a,b) :: (update client nombre liste);;


let rec name client e liste =
       match liste with
        [] -> []
       |(a,b)::liste -> if a = client
                        then (e,b)::liste
	                else (a,b)::(update client e liste);;
